﻿using Net8.Project.Model.Dto;
using Net8.Project.Model.Entity;
using Net8.Project.Model.Tenants;

namespace Net8.Project.Extension
{
    public class CustomProfile: AutoMapper.Profile
    {
        public CustomProfile()
        {
            // 在这里定义映射配置，默认情况下，AutoMapper会自动映射同名属性
            // CreateMap<Source, Destination>();

            // 将User和UserDto的字段进行自定义字段映射
            CreateMap<User, UserDto>()
                .ForMember(d => d.Name, o => o.MapFrom(src => src.Name))
                .ForMember(d => d.LoginPWD, o => o.MapFrom(src => src.LoginPWD));
            CreateMap<UserDto, User>()
                .ForMember(d => d.Name, o => o.MapFrom(src => src.Name))
                .ForMember(d => d.LoginPWD, o => o.MapFrom(src => src.LoginPWD));

            CreateMap<AuditSqlLog, AuditSqlLogDto>();
            CreateMap<AuditSqlLogDto, AuditSqlLog>();


            CreateMap<BusinessTable, BusinessTableDto>();
            CreateMap<BusinessTableDto, BusinessTable>();

            CreateMap<MultiBusinessTable, MultiBusinessTableDto>();
            CreateMap<MultiBusinessTableDto, MultiBusinessTable>();

            CreateMap<SubLibraryBusinessTable, SubLibraryBusinessTableDto>();
            CreateMap<SubLibraryBusinessTableDto, SubLibraryBusinessTable>();


            CreateMap<SysTenant, SysTenantDto>();
            CreateMap<SysTenantDto, SysTenant>();
        }
    }
}
